package com.ltw.modules.common.entity;

import org.apache.commons.lang3.StringUtils;

/**
 * @Description SearchBean
 * @Author HymanHu
 * @Date 2021/9/14 9:54
 */
public class SearchBean {

    private int currentPage;
    private int pageSize;
    private String orderBy;
    private String direction;
    private String keyword;

    public void initSearchBean() {
        if (this == null) {
            return;
        }
        this.currentPage = this.currentPage == 0 ? 1 : this.currentPage;
        this.pageSize = this.pageSize == 0 ? 5 : this.pageSize;
        this.direction = StringUtils.isNotBlank(this.direction) ? this.direction : "asc";
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }
}
